#
# Scanner Test
#

require 'soul/core'
require 'soul/scanner'
require 'test/unit'

class S < Soul::Scanner

	skip 	space
	rules(	{
			:number => +digit,
			:plus		=> '+',
			:minus	=> '-'
	})

end

class TestScanner < Test::Unit::TestCase

	def setup
		@s = S.new
	end

	def test_scanner
		assert(@s.scan("1") == [ :number ])
		assert(@s.scan("1+9") == [ :number, :plus, :number ])
		assert(@s.scan("12") == [ :number ])
	end

end
